//
//  HMEditViewController.m
//  HMWeChat
//
//  Created by apple on 2017/5/11.
//  Copyright © 2017年 itheima. All rights reserved.
//

#import "HMEditViewController.h"

@interface HMEditViewController ()
@property (weak, nonatomic) IBOutlet UITextField *contentTF;

@end

@implementation HMEditViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
}

- (IBAction)clickCancelItem:(id)sender {
    
    //返回
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)clickSaveItem:(id)sender {
    //获取当前的电子名片
    XMPPvCardTemp *myvCard = [HMXMPPManager sharedManager].xmppvCard.myvCardTemp;
    //修改具体的内容
    if ([self.title isEqualToString:@"编辑个性签名"]) { //修改个性签名
        
        myvCard.desc = self.contentTF.text;
        
    }else { //修改昵称
    
        myvCard.nickname = self.contentTF.text;
    }
    
    //更新数据到电子名片
    [[HMXMPPManager sharedManager].xmppvCard updateMyvCardTemp:myvCard];
    
    //返回
    [self.navigationController popViewControllerAnimated:YES];
}

@end
